import { applyMiddleware } from 'redux';

import { createStore } from 'redux';
import { thunk as reduxThunk } from 'redux-thunk';
import reduxProimse from 'redux-promise';
import reduxLogger from 'redux-logger';
import reducer from './reducers';

const middleware = [reduxThunk, reduxProimse];

if (import.meta.env.MODE === 'development') {
  middleware.push(reduxLogger);
}

const store = createStore(reducer, applyMiddleware(...middleware));

export default store;
